package in.iqing.model.bean;

/**
 * Created by ZuoShu on 15/7/9.
 */
public class DirectoryItem {
    public enum Type {
        VOLUME,
        CHAPTER
    }

    private String title;
    private Type type;
    private Chapter chapter;

    private DirectoryItem() {
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    public Chapter getChapter() {
        return chapter;
    }

    public void setChapter(Chapter chapter) {
        this.chapter = chapter;
    }

    public static DirectoryItem fromVolume(Volume volume) {
        DirectoryItem item = new DirectoryItem();
        item.type = Type.VOLUME;
        item.title = volume.getTitle();
        return item;
    }

    public static DirectoryItem fromChapter(Chapter chapter) {
        DirectoryItem item = new DirectoryItem();
        item.type = Type.CHAPTER;
        item.title = chapter.getTitle();
        item.chapter = chapter;
        return item;
    }

}
